package com.qjc.interceptor.login;

import com.qjc.interceptor.BaseInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 学员端api 拦截器
 * @author zengjintao
 * @version 1.0
 * @create_at 2020/11/21 21:38
 */
@Component
public class StudentAuthInterceptor extends BaseInterceptor {

    @Autowired
    private JwtToken studentJwtToken;
//    @Autowired
//    private StudentInfoService studentInfoService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        StudentInfoSession studentInfoSession = studentInfoService.getStudentInfoSession();
//        if (ObjectUtils.isEmpty(studentInfoSession)) {
//            Result.renderJson(response, Result.fail(ResultCode.UN_AUTH_ERROR_CODE));
//            return false;
//        }
         return checkToken(studentJwtToken, request, response);
    }
}
